package com.gzh.anno;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component("myAspect")
@Aspect
public class MyAspect {
    @Before("MyAspect.pointCut()")
    public void  before(){
        System.out.println("前置增强！！！");
    }
    @AfterReturning("MyAspect.pointCut()")
    public void  afterReturning(){
        System.out.println("后置增强！！！");
    }
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕前增强！！！");
        Object proceed = pjp.proceed();
        System.out.println("环绕后增强！！！");
        return proceed;
    }
    public void throwding(){
        System.out.println("异常增强！！！");

    }
    public void after(){
        System.out.println("最终增强！！！");
    }

    
    @Pointcut("execution(* com.gzh.anno.*.*(..))")
    public void pointCut(){

    }
}
